﻿<!DOCTYPE html >
<html>
<head>
    <link href="images/5.icon" rel="icon" type="image/x-icon" />
    <title>腾飞健康主页</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="lib/layui/css/layui.css">
    <style>
        .word {
            position: absolute;
            right: 10px;
            bottom: 10px;
            color: #aaa;
            font-size: 12px;
        }

        .newBtn {
            width: 30px !important;
            height: 20px !important;
            line-height: 20px;
            text-align: center !important;
            padding: 0px;
            font-size: 20px;
        }

        .layui-form-select dl {
            max-height: 200px;
        }
    </style>
</head>
<body>
    <div class="head">
        <div class="w1300">
            <div class="top c">
                <div class="l">
                    <span>
                        <script>
                            var d = new Date();
                            document.write(d.getHours() + "时:" + d.getMinutes() + "分"); 
                        </script>
                    </span>
                </div>
                <div class="r">
                    <a href="/guanyuwomen" target="_blank">关于我们</a><a href="/baozhuzhongxin"
                        target="_blank">帮助中心</a></div>
            </div>
            <div class="center c">
                <div class="logo l">
                    <img src="images/logo.jpg" />
                </div>
                <div class="search l">
                    <input placeholder="请输入套餐名称,体验内容等" />
                    <div class="btn">
                        <img src="images/search.svg" />
                    </div>
                </div>
            </div>
            <div class="nav c">
                <ul>
                    <li class="act"><a href="/index" target="_self">首 页</a></li>
                    <li><a href="/yiyuan" target="_self">体 验 医 院</a></li>
                    <li><a href="/taocan" target="_self">体 验 套 餐</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="sec1">
        <div class="w1300">
            <div id="list-mainbox">
                <div class="user_fl fl new-user_fl">
                    <h1>
                        订单管理</h1>
                    <div class="user_order">
                        <ul>
                            <li class="click"><a href="/userdingdan">未成功订单</a></li>
                            <li><a href="/userdingdanwc">成功订单</a></li>
                            <li><a href="/userdingdanwcg">未完成订单</a></li>
                        </ul>
                    </div>
                    <h1>
                        个人信息</h1>
                    <div class="user_order">
                        <ul>
                            <li><a href="user.html">个人资料设置</a></li>
                            <li><a href="/anquan">安全设置</a></li>
                        </ul>
                    </div>
                    <h1>
                        历史记录</h1>
                    <div class="user_order">
                        <ul>
                            <li><a href="/baogao">体检报告</a></li>
                        </ul>
                    </div>
                </div>
                <div class="user_rt rt new-user_rt" style="background-color: #F1F1F1">
                    <form class="layui-form layui-form-pane">
                        <div style="height: 13px"></div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-block">
                                <input type="text" name="userName" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">性别</label>
                            <div class="layui-input-block">
                                <input type="text" name="sex" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">年龄</label>
                            <div class="layui-input-block">
                                <input type="text" name="age" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">婚姻状况</label>
                            <div class="layui-input-block">
                                <input type="text" name="matrialStatus" autocomplete="off" class="layui-input" disabled>
                            </div>
                        </div>
                    </form>
                </div>

                <div style="float: right; width: calc(100% - 2px - 25%); height: 550px;border-top: #dddddd solid 2px; border-bottom: #dddddd solid 2px; border-left: #dddddd solid 2px; overflow-y:auto">
                    <form class="layui-form layui-form-pane">
                        <div style="margin: 10px">
                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                <legend>个人信息</legend>
                            </fieldset>

                            <!--<button class="layui-btn" name="editBaseMsg">&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;</button>
                            <div style="margin-bottom: 10px;"></div>-->

                            <div class="layui-form-item">
                                <input type="hidden" name="userIdentity" value="">
                                <div class="layui-inline">
                                    <label class="layui-form-label">电话</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="phone|required" name="telephone">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">工作单位</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="required" name="workUnit">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">籍贯</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="required" name="nativePlace">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">住址</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="required" name="address">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">职业</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="required" name="occupation">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">文化程度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" lay-verify="required" name="education">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">民族</label>
                                <div class="layui-input-block">
                                    <select name="nationId" lay-verify="required" lay-filter="nationId">
                                    </select>
                                </div>
                            </div>

                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                <legend>生活习惯</legend>
                            </fieldset>

                            <!--<button class="layui-btn" name="editLiveHabit">&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;</button>
                            <div style="margin-bottom: 10px;"></div>-->

                            <div class="layui-form-item">
                                <label class="layui-form-label">饮食习惯</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" lay-verify="required" name="dietaryHabit">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label"
                                           style="width: 150px; text-align: left">&nbsp;&nbsp;&nbsp;脑力工作强度</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="sleepQuality" name="mentalWorkload">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label" style="width: 150px; text-align: left">体力工作强度</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="sleepQuality" name="physicalWorkload">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">睡眠长度</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="required" name="sleepLength">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">睡眠质量</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="sleepQuality" name="sleepQuality">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">吸烟情况</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="sleepQuality" name="smokeStatus">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">饮酒情况</label>
                                    <div class="layui-input-inline">
                                        <input class="layui-input" lay-verify="sleepQuality" name="drinkStatus">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">其它习惯：</label>
                                <div class="layui-input-block">
                            <textarea name="otherHabit" placeholder="请输入内容" class="layui-textarea"
                                      style="position: relative"
                                      maxlength="500"
                                      onpropertychange="if(value.length>500) value=value.substr(0,500)"
                                      oninput="wordLeg(this);" lay-verify="required"></textarea>
                                    <div class="word">
                                        <span class="text_count" name="otherHabit">0</span> / <span class="num_count"
                                                                                                    id="numCount1">500</span>
                                    </div>
                                    <div style="margin-top: 20px"></div>
                                </div>
                            </div>
                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                <legend>当前健康状况</legend>
                            </fieldset>

                            <!--<button class="layui-btn" name="editPresentConditon">&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;</button>
                            <div style="margin-bottom: 10px;"></div>-->

                            <div style="border: 1px solid #dddddd; border-radius: 3px; padding: 10px; padding-top: 15px;">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">疾病名称</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" name="presentDiseaseName">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">患病时间</label>
                                        <div class="layui-input-inline">
                                            <input type="text" id="presentSickTime" class="layui-input" lay-verify="date"
                                                   name="presentSickTime">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否治疗</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="presentInTreatment" value="true" title="是">
                                            <input type="radio" name="presentInTreatment" value="false" title="否">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否服药</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="presentInMedicine" value="true" title="是">
                                            <input type="radio" name="presentInMedicine" value="false" title="否">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">服用药物</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="presentMedicineName">
                                    </div>
                                </div>
                            </div>
                            <!--<div style="text-align: center">
                                <button class="layui-btn layui-btn-primary newBtn">+</button>
                            </div>-->

                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                <legend>既往病史</legend>
                            </fieldset>

                            <!--<button class="layui-btn" name="editPastHistory">&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;</button>
                            <div style="margin-bottom: 10px;"></div>-->

                            <div style="border: 1px solid #dddddd; border-radius: 3px; padding: 10px; padding-top: 15px;">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">疾病名称</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" name="pastDiseaseName">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">患病时间</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" lay-verify="date" id="pastSickTime" name="pastSickTime">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否治疗</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="pastInTreatment" value="true" title="是">
                                            <input type="radio" name="pastInTreatment" value="false" title="否">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否服药</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="pastInMedicine" value="true" title="是">
                                            <input type="radio" name="pastInMedicine" value="false" title="否">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">服用药物</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="pastMedicineName">
                                    </div>
                                </div>
                            </div>
                            <!--<div style="text-align: center">
                                <button class="layui-btn layui-btn-primary newBtn">+</button>
                            </div>-->

                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                                <legend>家族病史</legend>
                            </fieldset>

                            <!--<button class="layui-btn" name="editFamilyHistory">&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;</button>
                            <div style="margin-bottom: 10px;"></div>-->

                            <div style="border: 1px solid #dddddd; border-radius: 3px; padding: 10px; padding-top: 15px;">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">疾病名称</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" name="familyDiseaseName">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">患病时间</label>
                                        <div class="layui-input-inline">
                                            <input class="layui-input" lay-verify="date" id="familySickTime" name="familySickTime">
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">血缘关系</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="kinship" value="true" title="是">
                                            <input type="radio" name="kinship" value="false" title="否">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">是否治愈</label>
                                        <div class="layui-input-inline">
                                            <input type="radio" name="isRecovery" value="true" title="是">
                                            <input type="radio" name="isRecovery" value="false" title="否">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--<div style="text-align: center">
                                <button class="layui-btn layui-btn-primary newBtn">+</button>
                            </div>-->

                            <div class="layui-form-item">
                                <div class="layui-input-block" style="padding-left: 10%;padding-top: 15px">
                                    <button type="submit" name="submit" class="layui-btn layui-btn-disabled" lay-submit=""
                                            lay-filter="submitValue">立即提交
                                    </button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="foot">
        <p align="center">
            版权所有 腾飞健康</p>
    </div>
    <script type="text/javascript" src="lib/layui/layui.js"></script>
    <script>
        layui.use(['layer', 'jquery', 'table', 'form', 'laydate'], function () {
            let $ = layui.jquery;
            let table = layui.table;
            let form = layui.form;
            let laydate = layui.laydate;
            let layer=layui.layer;

            /*$("#clear").on("click", function () {

            });*/



            //民族下拉框渲染
            $(document).ready(function () {
                console.log("民族");
                $.ajax({
                    url: "/getNations",
                    dataType: "json",
                    type: "post",
                    success: function (responseData) {
                        console.log(responseData);
                        console.log("success　Method");
                        $("select[name=nationId]").html("").append("<option>请选择</option>");
                        for (let i = 0; i < responseData.length; i++) {
                            $("select[name=nationId]").append("<option value=" + responseData[i].nationId + ">" + responseData[i].nationName + "</option>");
                        }
                        form.render();
                    },
                    error: function () {
                        console.log("民族信息请求失败！");
                    }
                });

            });

            $("#search").on("click", function () {
                let searchUserIdentityInput = $("#searchUserIdentityInput").val();
                let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if (reg.test(searchUserIdentityInput)) {
                    $.ajax({
                        url: "/getUserMsgById",
                        dataType: "json",
                        data: "userIdentity=" + searchUserIdentityInput,
                        type: "post",
                        async: true,
                        success: function (responseData) {
                            if (responseData['code'] == 0) {
                                layer.msg("未找到用户信息！", {
                                    icon: 2,
                                    time: 1500
                                });
                                $("input[name=userName]").val("");
                                $("input[name=sex]").val("");
                                $("input[name=age]").val("");
                                $("button[name=submit]").addClass("layui-btn-disabled");
                            } else {
                                $("input[name=userIdentity]").val($("#searchUserIdentityInput").val());
                                $("button[name=submit]").removeClass("layui-btn-disabled");
                                $("input[name=userName]").val(responseData['user'].userName);
                                if ((responseData['user'].userIdentity.substring(16, 17)) % 2 != 0) {
                                    $("input[name=sex]").val("男");
                                } else {
                                    $("input[name=sex]").val("女");
                                }
                                $("input[name=age]").val((new Date().getFullYear()) - (responseData['user'].userIdentity.substring(6, 10)));
                                if (responseData['user'].maritalStatus == true) {
                                    $("input[name=matrialStatus]").val("已婚");
                                } else {
                                    $("input[name=matrialStatus]").val("未婚");
                                }
                            }
                        },
                        error: function () {
                            console.log("获取挂号信息请求失败！");
                            layer.msg("服务器错误！", {
                                icon: 2,
                                time: 1500
                            });
                        }
                    });
                } else {
                    layer.msg("输入错误！", {
                        icon: 2,
                        time: 1500
                    });
                    $("input[name=userName]").val("");
                    $("input[name=sex]").val("");
                    $("input[name=age]").val("");
                    $("button[name=submit]").addClass("layui-btn-disabled");
                    form.render();
                }
            });

            form.on("submit(submitValue)", function (data) {
                console.log(data.field);
                $.ajax({
                    url: "/submitUserMsg",
                    dataType: "json",
                    data: data.field,
                    type: "post",
                    success: function (responseResult) {
                        if(responseResult.code==1){
                            layer.msg(responseResult.msg, {
                                icon: 1,
                                time: 1500
                            });
                        }else{
                            layer.msg(responseResult.msg, {
                                icon: 2,
                                time: 1500
                            });
                        }
                    },
                    error: function () {
                        console.log("写入健康信息请求失败！");
                        layer.msg("服务器错误！", {
                            icon: 2,
                            time: 1500
                        });
                    }
                })
                return false;
            });

            //个人信息编辑按钮
            // $("button[name=editBaseMsg]").on("click", function () {
            //
            // });

            //日期输入框渲染
            laydate.render({
                elem: '#presentSickTime'
            });
            laydate.render({
                elem: '#pastSickTime'
            });
            laydate.render({
                elem: '#familySickTime'
            });

            //返回首页index.html
            $("a[name=goBackIndex]").on("click", function () {
                window.open("/unitIndex", "_top");
            });

            //备注输入框字数显示
            window.wordLeg = function (obj) {
                var currleg = $(obj).val().length;
                var length = $(obj).attr('maxlength');
                if (currleg >= length) {
                    layer.msg('字数请在' + length + '字以内');
                } else {
                    $('span[name=' + obj.name + ']').text(currleg);
                }
            }
        });
    </script>
    <script type="text/html" id="operationTple">
        <div class="layui-btn-container">
            {{# if(!d.filledStatus){ }}
            <span class="layui-btn layui-btn-default layui-btn-xs" lay-event="examine"
                  style="padding-right: 5px;margin-right: 5px">检查</span>
            {{# } }}
            {{# if(d.filledStatus){ }}
            <span class="layui-btn layui-btn-default layui-btn-xs layui-btn-disabled" disabled="disabled"
                  style="padding-right: 5px;margin-right: 5px">检查</span>
            {{# } }}
        </div>
    </script>
    <script type="text/html" id="filledStatusTple">
        {{# if(!d.filledStatus){ }}
        <span style="color: red">未检查</span>
        {{# } }}
        {{#　if(d.filledStatus){ }}
        <span style="color: green">已检查</span>
        {{# } }}
    </script>
</body>
</html>
